[AURON #2732] support platform option in Docker build mode#2371
[AURON #2732] support platform option in Docker build mode#2371zhaohehuhu wants to merge 1 commit into
Conversation
Do you mean building an |
There was a problem hiding this comment.
Pull request overview
Adds support for selecting a Docker target platform when building Auron in Docker mode, which is especially useful on ARM hosts that need to build linux/amd64 artifacts.
Changes:
- Adds a
--platformoption toauron-build.shand exports it viaAURON_DOCKER_PLATFORM. - Wires the exported platform into the Docker Compose service via the
platform:field.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dev/docker-build/docker-compose.yml | Uses AURON_DOCKER_PLATFORM to set the Compose service platform (with a default). |
| auron-build.sh | Adds --platform CLI parsing/validation and exports AURON_DOCKER_PLATFORM for Docker builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # ----------------------------------------------------------------------------- | ||
| USE_DOCKER=false | ||
| IMAGE_NAME="${SUPPORTED_OS_IMAGES[*]:0:1}" | ||
| DOCKER_PLATFORM="$DEFAULT_DOCKER_PLATFORM" |
| echo " --skiptests <true|false> Skip unit tests (default: true)" | ||
| echo " --sparktests <true|false> Run spark tests (default: false)" | ||
| echo " --docker <true|false> Build in Docker environment (default: false)" | ||
| echo " --platform <PLATFORM> Docker platform to use (default: linux/amd64)" |
Correct. I am trying to build an amd64 package on my local Mac. |
Does the package you built on your mac run correctly on an amd64 machine? I generally recommend building and running on a consistent CPU architecture to avoid unforeseen crashes, although I'm not sure if specifying the docker platform will prevent them. |
Yes, Auron has been working well so far. @wForget |
weiqingy
left a comment
There was a problem hiding this comment.
Thanks for taking this on. The title says [AURON #2732], but the PR closes #2372 — the digits look transposed, and #2732 doesn't exist. Since Auron squash-merges and the PR title becomes the commit subject on master, the wrong number would stick in history. (pr-title-check.yml only validates the shape [AURON #<digits>], so CI won't flag it.)
|
|
||
| services: | ||
| build-release: | ||
| platform: ${AURON_DOCKER_PLATFORM:-linux/amd64} |
There was a problem hiding this comment.
This line is also the answer to the amd64-on-ARM question raised in the thread, I think. Every build image installs an x86_64 Rust toolchain (--default-toolchain nightly-2025-05-09-x86_64-unknown-linux-gnu, in all five Dockerfiles), and docker-compose.yml:34 pins RUSTFLAGS: "-C target-cpu=skylake" unconditionally. So with platform: linux/amd64 it's an x86_64 rustc, running under emulation, emitting x86_64/Skylake codegen — the artifact should be the one a native amd64 host would produce, not an arm64 binary. Emulation costs build time, not correctness.
Worth noting the converse too: without this line, an arm64 host builds arm64 base images and then installs an x86_64 rustc it can't execute. So this looks less like "let me cross-build" and more like a fix for Docker mode on ARM hosts — which might be worth saying in the PR description, since it currently says there are no user-facing changes.
That's from reading the images rather than running the build, so worth a sanity check.
| --platform) | ||
| if [[ -n "$2" && "$2" != -* ]]; then | ||
| DOCKER_PLATFORM="$2" | ||
| if [[ ! "$DOCKER_PLATFORM" =~ ^[a-z0-9_.-]+/[a-z0-9_.-]+(/[a-z0-9_.-]+)?$ ]]; then |
There was a problem hiding this comment.
Given the x86_64-only images, --platform linux/arm64 passes this regex and then fails deep inside the image build — ubuntu24/debian11 hard-code JAVA_HOME=/usr/lib/jvm/java-*-openjdk-amd64 — with an error pointing nowhere near the flag.
Which raises the question I keep circling: if linux/amd64 is the only platform these images can build, the flag's one legal value is also its default. Is arm64 meant to work eventually — in which case the Dockerfiles need an arch-aware toolchain and JAVA_HOME, and RUSTFLAGS can't stay pinned to skylake? Or is amd64 the only supported target, in which case would the compose default alone be enough, without the flag?
Which issue does this PR close?
Closes #2372
Rationale for this change
Docker build mode needs a way to specify the Docker platform from
auron-build.sh, especially on ARM hosts where release builds may need to run aslinux/amd64.What changes are included in this PR?
as title
Are there any user-facing changes?
no
How was this patch tested?
rebuild auron with docker mode